changing return of undef to int