Fix bug in calculation of search starting position.