Bug fixes

Plus a neat addition to the map test.