Fixed bug in QSDcontract