Fixes issue #8
Fixes issue #27