Check for invalid devices first