The initial version that I posted did indeed have a bug. If it wound up not using any of the initial greedy guess, it would repeat the last element from the greedy guess. In your case that would explain why 191 repeated.
I fixed that bug, but obviously not before you downloaded the buggy version of the code.