Deferred cleanup and Test fix