cleanup and fix the boss restore bug