Fix return value for functions that return undefined