fixed error accessing undefined item