issue #733 fixed + tests