Fix case handling for manually set keys