added error in where middleware if out of bound index