Adding @Nullable annotations, fix NPEs