Theme Update Engine for my custom theme does’t work


I have a problem with my custom theme. This is my first theme in which I want to implement updates. I am trying to implement this class from url https://w-shadow.com/blog/2011/06/02/automatic-updates-for-commercial-themes/ and WordPress sees updates. But when I click UPDATE, the process stucks in maintenance mode with .maintenance file and strange directory name, f.ex when my theme’s directory name is fuga, after UPDATE it stucks with fuga-GRaUkT directory name. I don’t know what is wrong with my template. The zip file contains main template directory files and it is created from github release. What can I check to resolve this problem? I don’t even know where I can start debugging …