added is_object check

added a check to ensure that the $item was an object before checking if the method exists