lxml: fixes and improvements