Add map file and fix some bugs