Return error code on failure