fixed #111 by using html5lib for proper parsing/balancing