return statement error cases handled