added input index to error message