update to handle null values

added a condition to nullable types if db value was null