Fix extra overwrite bug. Thanks @smn