fix return types
use error codes instead of OT_FAIL