Added index error exception handling.