Add some null checks