fixed the overwrite bug