handle exceptions properly. Oh, and fix rand commit message