public.py: add type checking, fix broken tests that they catch