fix off-by-one bug in goto