Check last exists to break the loop