flush implementation broken