make toxic handle input in a more sane manner

Old branch got corrupted by some git black magic so I had to start fresh.

Segfaulting should be fixed now, and error messages are more verbose as well.