Fix map implementation

And the tests!