fix missing nil check