This fixes issues #68 and #81