Applying patch JCR-3349/JCR-3433

Applied fix from JCR-3349 to solve CRNT-27595