Fixes issues #146 and #144