Fixed crash after switching tabs.