Solved some bugs