hopefully fixed some bugs with reading ctg files