Ported back fixes from Pro. Fixed unit test cases.