Secure rand
Minor fixes