Fix code to change loop2