Recursively check against $devices

Forgot to add here when $devices was added in f0d4eb4df45b8b03bc11b84a1bf4b889507296ce