Fixed bugs with keys.