fixes for #595 #596