[DF-5091] Fix some bottlenecks in DLC. This may fix potential crashes and hangs during DLC
[DF-5091] Little fixes after review
[DF-5091] Return NULL in stead of exception.