fixes for #745
fixes for #536