Backporting fixes TIMOB-16323 and TIMOB-15987