Corrected a bucketload (ha ha!) of pointer/type inconsistencies