fix bug in testing code