minor bugfixes

minor fixes as well as some bug fixes in here.

fixes #32 
fixes #42