making sure start is always < end