fix bugs and improve map editor