Fix java.lang.ArrayIndexOutOfBoundsException: 1 when using collapsing