fix notice of undefined array index when expecting to throw