Bug fix on to / from JSON