Migrated how to avoid npe