Fixing error that was not correctly triggering the refresh event