NPE fix in onBeforeRender().