added overwrite detection