Fixed bug: game crashes at shutdown.