fix crash after reloading script