More informative logging of Cg errors and correct var type