wait for device before doing backup/restore

fix #242