Modify parseTemplate to work both with null and "undefined" keys