Correct implementation of cancel method
Make tests compatible with older version of python using unittest2