credit updates.
Fixing flusn() and drain() without callback
Merge branch 'palavrov-fixing-flush-drain-callback' into develop