fix count for postgres