Fix creating directories with bad mode