Fixed issues in where condition