fix errors in cut-n-pasted code