Fix minor bug in detecting active segments