added a possibility to not flush to disk