added flushing to prevent to many time