modified the condition check