Moving nil check to a better place