bugfixes

Closes #790