updated gateway lftp logic