Fix for #241 and #242