bugfixes

Fixes bugs introduced in last commit.