Fixed flag-dir bug