fix copying of optionals