fix an issue with refreshing resources

Fixes https://github.com/dart-lang/spark/issues/2622; @dinhviethoa