Bug fix for #64 and #65

Bug fix for #64 and #65