fix duplicate entry when uploading same file

fixes #2007
fix typo in error message