fixes for #586