Fixes an error in address looping