add spec and nil check