fix bug in creating directory