Adding check for index, #186.

Signed-off-by: Zane M. Kolnik <zanematthew@gmail.com>