Fix issue with null check being the wrong way round.