Fixed an index bug and added alerts