rearranged counter interface, fixed lookup bug in counter.avail(), added internal whichlib()