added server side error formatting