fixing bug in refresh logic, and updating gems