 	createNote: (name, notebook, content) ->
 		id = generateUid()
 
-		while fs.existsSync(path.join(@notebookdir, notebook, id  + ".noted"))
+		while fs.existsSync(path.join(@notebookdir, notebook + "." + id  + ".noted"))
 			id = generateUid()
 
-		fs.writeFile path.join(@notebookdir, notebook, id  + ".noted"),
+		fs.writeFile path.join(@notebookdir, notebook + "." + id  + ".noted"),
 			JSON.stringify {
 				id: id
 				name: name

	constructor: (@notebookdir) ->

	###
	# Creates a new notebook
	# @param {String} name The notebook name
	# @return {String} id The new notebook id

		id = generateUid()

		# there's a 16^16 chance of conflicting, but hey
		while fs.existsSync(path.join(@notebookdir, id  + ".json"))
			id = generateUid()

		fs.writeFile path.join(@notebookdir, id + ".json"),
			JSON.stringify {
				id: id
				name: name
