minor fixes plus first version of htm_match parser, should be tested