imc: return error codes instead of 0 for error conditions.