fixed the 'flush' issue by not using flush