fixed some bugs in level editor