issue #1184: return error codes more consistently
issue #1184: use error codes more consistently