handle primitives in array for heap objects

There was a problem with on heap object generation when you have arrays of primitives.
I've fixed as below.