failed to return a value in function