Fix null pointer when initing variables.