Fixes #229 and #241