additional error check in scan examples for pi