fixed doubled numkeys args, and kept intermediate keysLength var to cover empty keys argument pass case