Fixes a bug replacing device key