fixing refresh bug