Implemented array index bounds check.

How come I forgot about this...