fixing issue #7, contribution from Franck Michel