fix return value in a function