Removed useless order/limit filters for count and went back to the original count method, but still using the mysql adapter's buildWhere function.