Yeah, that seems to be a big problem. There should be some sort of integrity check. If the data is invalid, return $null immediately.