Null pointer exception fixes at startup