When detecting more beads in a residue than expected the code breaks when trying to write the final oriented pdb. This can be avoided entirely by ensuring that each residue within a chain has a different residue ID. A fix to this issue will be forthcoming soon.