Moved the code for creating a ref object by value from the marshalling printer to a valid ctor by value.

Signed-off-by: Dimitar Dobrev <dpldobrev@yahoo.com>
Merge pull request #323 from ddobrev/master

Moved the code for creating a ref object by value from the marshalling printer to a valid ctor by value