fix cancelAfter and its tests