adding error catching on reloading