move newPrimitiveArray to context as well