fixed error when refreshing on browser