fixed several tests related to previously shared variables in the while loop