Fix "anonymous function does not always return a value" warning