fix for issue #7 and new tests