Actually, I've found the issue as far as the duplicates. I believe it's caused by the dwsf_add_attachments function. You're renaming the image using..
$image_name = time().'.'.$ext;
But that can be a problem when the script is running fast enough so that more than one image gets the same name. How I solved it was by adding the post id as so...
$image_name = $post_id.'-'.time().'.'.$ext;
Which seems to have solved it. =)