Better error reporting; rand-nth; fixed bug