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>