Fixed issue 39

This fixes issue #38 too.