Added handling of IndexOutOfBounds exception, with and without a message.