All tests pass and fixed null ref

Change-Id: Ib53d64c3114abad4ada2a1f62491d5d290b478c4