Additional fixes for GRAILS-10708
- fix returning error code