Fix bug where refresh would be triggered twice