was missing a nil check