fixed incorrect ->where() queries