Fixed code problems with mulitple keys.