Better errors on incorrect parameter types

Unfortunately this is a bit hard to put in the test suite
as it is testing a hard crash scenario in the GUI thread.
Better wrapping of values and better errors