Fix a few bugs on editor