Fixed bug in contraction code.