refresh immediately
added agent detection code