check for object before calling method