Do some null checkings.