Bugfixing on the device management