fixed bug in refresh