Fix start and end value bug