Fixed some potential segfaults in DTSC library.