fix potential npes