PGS Subs: Don't read from null ptr and Flush on error