separate if conditions to identify NPE