fix bug in type evaluation

- fix that const or reference type was used to create memory