Fixed json_encode bug