make map a const and fix const correctness