Update driver.cpp

change index-1>-1 to index>0
change index-2>-1 to index>1