Fixed type errors with map and maybe JSON