Bugfixes for SFTP support

...and move SFTP upload to asynchronous so the main loop continues to
run