A few bugfixes, prevent same device being open multiple times