strengthen backend to handle malformed json