Improved the shutdown sequence. Stored the applet stub in bot context.