fixed some bugs in the functional tests