Fix bug in test code