fix arr.size is zero errors