fixed the index out of bounds exception that caused application to crash during first pilot test.