Fix null pointers caught by FindBugs