Fixed incorrect variable name

The encoded variable must be $pk and not $key.