add type safety for map type