improved ctcp handler method, fixes #1011