only call cb() if a cb is defined