Merge pull request #811 from am11/master

Code: Analysis & minor improvements
TypeScript: FIxes intellisense condition. (#812)
Code: Null checks.