Corrected some bugs in editor