 		if o
 			@ownerDocument._private.idMap[value] = @
 		@attributes.id = value
-Node::__defineGetter__ 'className', () -> @attributes['class']
+Node::__defineGetter__ 'className', () -> @attributes['class'] or ""
 Node::__defineSetter__ 'className', (value) ->
 	if value in [null, undefined, "undefined"]
 		delete @attributes.class

			when Node.ELEMENT_NODE
				Element::toString.call @, pretty, deep, indentLevel
			when Node.ATTRIBUTE_NODE
				"#{indent}#{@nodeName}=\"#{@nodeValue}\""
			when Node.CDATA_SECTION_NODE
				"#{indent}<![CDATA[#{@nodeValue}]]>" + newline
			when Node.COMMENT_NODE

		else
			indent = ""
			newline = ""
		attrs = ((" #{a}=\"#{@attributes[a]}\"" if @attributes[a] isnt "") for a of @attributes).join('')
		len = @childNodes.length
		end = switch len
			when 0 then "/"
			else ""
		ret = [indent + "<#{name}#{attrs}#{end}>" + newline]
		r = 1
		if deep
