fix bug in test code