fix performance issues in map