Added array bounds check on table select - fixes #12