Fix bugs in refresh page