fix count anf flat