fix a bug in random search where params were not encoded in correct type