[TS-2488] uncomment all unit tests and patch code to make them all pass