Fixing NPE in object conversion logic