Fix null conversion. Move sandboxing code to sandbox(). Choose random UID/GID.