fixed issue #8 and related example