fix cancelAfter and its tests
fix duplicate slave tests to wait for the correct detach to complete