Fixes

These are a couple of minor fixes, plus I think it makes sense to use `java.security.SecureRandom` here.

Please merge these if you think it's OK.