Fix bugs in pagerank and sample

- sample could get stuck if sampling perc was low