Fix the issue in WhenAnyTrue function