Fix some issues with using the toolkit in an application.