Fix typescript 0.9.5 compilation issues.

Other fixes to make code more consistent.