flatten unnecessary directories