Undefined object fix