fix bug where mkdir can be done twice