Fixed NPE in CTM
Merge pull request #40 from MikeLydeamore/master

Fixed NPE in CTM fixes #39 and #28