fixing issue #11 as proposed