Fix NPE
Prevent ArrayIndexOutOfBoundsException