Some optimization for map.js