Fix NPE on build errors