Fixed: didn't update loc

needed to update loc, previous code has an infinite loop