Changed funciton flushBytes to flush