Fixed bug in test code