LPS-33068 [TECHNICAL SUPPORT] variable is not updated properly in a while loop