Fix illegal REST response building