Could excess 529 distribution be reversed?

CA ScholarShare 529 - entering college this fall and educating myself on 529 distribution strategies.  I understand that if a college issues a tuition refund for a dropped class for example, that amount can be re-contributed back to the 529 plan.

(a) Can this refund go back to the original plan or it must be a new one?

(b) What if "I" make a calculation mistake and withdraw more than the qualified expenses - can I re-contribute it back?

TIA