Adding if to check if unref method is present.