fixing directory empty problem on cancel