Improved and fix bugs in refresh.