Fix overwrite logic.