fix a couple bugs plus add usage to random_test.sh