Fix keys when using cap constraint