Added NPE check.