1.7.x bugfixes

collection of some of my safe bugfixes backported to 1.7.x