Fix some bugs with functional test framework.