added "overwrite" flag