fix bug in getAvailDocId()