fix race condition that was causing hangs with "ftp ls"