moved return statement for error message