added a missing return statement in the error case.