Fixed out of index errors.