Fix some null checks to actually test the part that needs checking.