Use os.makedirs insteady of os.mkdir
Merge with master