Return correct code for error
Use correct name for struct entries
vpt may be NULL
Don't confuse the scanner