Fixed refresh timing bug