fixed bug in automatic refresh