Re-add the cleanup code. Apparently it was needed?