Some fixes for #186