Fix potential NPEs