Fixing refresh bug