Fixes ArrayIndexOutOfBoundsException

Was experiencing java.lang.ArrayIndexOutOfBoundsException on backup.  
This commit fixes it by not allowing the for() loop to search past the bounds of the array.