Fixed the selects(...) broken by the count(): now the query is cloned before a count() is applied