Fixes issues #51 and #52