fixed prev_count