Make sure that the directory exists first