Fixed some bugs reported by tsc 0.9