updated file handling for sftp session