some fixes and tests for ID-161