fix ret value setting