make sure we always send back json errors