add check on splitted array size before looping