Changed manager deletion order to prevent crashes.