Note that there is incorrect behavior in directory.c code. Arma, please check this...