fixed bug in checkConditions