issue #831 fixed + couple of tweaks