replacing nulls with optional