bugs in the contraction code