fixing bug in return values