catch errors in reload hook