Add dimension checking to compose