Fix mode cleanup