Fixes #379 and #190