fixes issue #11 and issue #14