Fixes two bugs with sftp downloads