Fixed a bug in height map editor. Some optimisations.