solved some bugs