fixing NullPointerException