added invalid DOM tag count checking
minor correction to constructor
added test case