Better way to avoid the NRE