Fixed a bug in creating a model reference and enhanced support for virtual fields