Fix bug with array size calculation