Adding some checks to access the map