fix function ends without a return statement