various fixes for #189