Fix "device not open" error