returning errors correctly

now it returns an object with "errors" as a property, instead of just
returning the error list