fails when function is nil