Added creation of directory in case it doesn't exist