Added extra check to the condition