fixed minor bugs in map.js