fixes the json encoding problem