Fixed GetReference and GetByPrimaryKey not working with boxed types