adds check for data index