Optimize `isValidBackend`