Fix flush directory method