Fix overwrite bug