Fix some bugs in sftp backup