Fixed some bugs in runtests