[WIP] Fix ht interface

Resubmit from #105 onto master
because `int` _can_ be negative, and a counter is always positive. This way it is clear that a negative return value is not possible.