Fixed serious bug in publish method that would wipe out the callback function