serveral bugfixes

see gitlog