fixed a null pointer that happened when state variables had null values