added NPE protection