Fixing flush() and drain() without callback

Calling port.flush() or port.drain() methods fails when there is no callback provided.