Bug fix with changing agent key when updating devices and caching