Ensure headers are set correctly for json output