[OE-3987] bugfixes and tests