fixed adding new devices to DB (cast to the correct object)