Fixed a leak and added a safety check when rvalue casting a Value object.