safer usage of map