fix issue with .count().where() chaining #419