Fixed a few index errors