Fixed error in condition for smart clustering