Fix refresh logic