changed some implementations to match the DOM4 spec