SysFile::getAvailName, fixing bugs