Fixed regexps and bugs in test code