fixed calculation of fragment_count