Fixed some bugs. Now it starting to work