handled possible NullPointerException