added missing functions for map manipulation, and various bugfixes