better debugging for wrong type, fix emulator tests, fixes #176

Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>