DropBox bug fixes (rebased onto develop)

Rebased on develop, see #810

See the other PR for the two bugs fixed here. It should be possible to test them both at the same time by using scenario in the initial comment at #810 on a Windows server. Checking DropBox.log for failed imports and failed file deletes.