Bug killing spree

Fixes #32, #43, #58, #60
I suggest opening a new issue for #32 because my solution is only a workaround (see also my code comment).