Fix for continuous refreshing bug