Fix "IndexError: pop index out of range"

Account for the index offset caused by popping items from self.marks.