fixed the bug in feature counting