Fix error and reinstate JSON check