Fix to issue where sftp does not work as expeected