Fixed bug with refreshing