Fix bug in test scripts