Fix bug #2590

replaced wrong check to correct check