Adds check to create missing directories