Fix linking order.
Fix random number generation.
Fix permissions.