added null check when saving map instance