Fixed segmentation fault in array indexing size