Fix array variable evaluation

if X is int array, a variable pointing to X should
return also a int array but X[0] should
return just int.

Return newly created types instead of modifying
the current ones