fixed map toggle code