add error check to sequence.c to make sure begin != end otherwise we divide by zero