Adding map to fix some bugs