Mass. lawmakers OK bill to repair, remove old dams