Fixes for #237 and #326