Update to prevent partial word error

Added a second while loop to prevent only partial word update