Fixes #488.
Merge pull request #546 from philipn/fix_map_js_error

Fixes #488.