HHH-8783 corrected logic