fix prefix counting