Fix a bug, which was caused by the set_dev_paths() function leavning stale data around.

Also make things a little more robust, so they don't crash