Fix for termination cases that Andrew points out, not performant, but bits are cheap