fixed the flush errors