correct return value on error