Fix JSON responses

Fixes #172