Bug fixes for #193