changed where function for issue with postgre