Make dialyzer happy

Hi there,

for my projects I am using the strictest dialyzer setup possible.
The following changes will make dialyzer (R16B) completely happy:

Use ets:tab() instead of ets:tid(), refine type specs such that the
code passes dialyzer with options -Wunmatched_returns,
-Werror_handling, -Wrace_conditions, -Wunderspecs

Please consider to merge these changes.
Thanks.