fix potential NPEs