Fixed nullPointerException bug occurring at startup