can handle nil as function now, release delegate when cleaning up