Added bounds check when addressing a string variable in an array