fix crash problem when no device found