Fix $key setting, and array normalization (!).