added a ifdef for ERROR_INDEX