bug fixes for keep_sequence_range.py