Fixed possible crash at the refresh button