Added bounds-checking for thisCount.