fixed CTM file polling bug. Added some additional error checking for EOF conditions.