fixes issue #7 and issue #8