Fixed exceptions on switching scenes