fix a bug in random search