make sure cb is always defined ans a function before calling