fix null-ptr error

I don't know how this ever worked