Adding missing constructor and fixing NPE