misc/map - various bug fixes and cleanup

Fixes #300