Fixed creation of dirs if they don't exist