update err in ex2.R Q4 and Q5