use the correct err in panic