Fixed some errors in test generation