Fixed where condition bug