Changes to handle empty fields as NULL values