code from FTP 10.22