Fix handling of domain dimension.