fix bad return value from function