Added NPE protection