Fix for #229 and #207