Add a few null checks