diff --git a/libs/clipboard/src/lib.rs b/libs/clipboard/src/lib.rs
index 0e80cda2d..3b58dd2ab 100644
--- a/libs/clipboard/src/lib.rs
+++ b/libs/clipboard/src/lib.rs
@@ -4,8 +4,10 @@ use std::{
     sync::{Arc, Mutex, RwLock},
 };
 
+#[cfg(any(target_os = "windows", feature = "unix-file-copy-paste",))]
+use hbb_common::allow_err;
 use hbb_common::{
-    allow_err, lazy_static, log,
+    lazy_static,
     tokio::sync::{
         mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender},
         Mutex as TokioMutex,
diff --git a/src/server.rs b/src/server.rs
index 0e1abfd55..e019f1889 100644
--- a/src/server.rs
+++ b/src/server.rs
@@ -95,7 +95,7 @@ pub fn new() -> ServerPtr {
         id_count: hbb_common::rand::random::<i32>() % 1000 + 1000, // ensure positive
     };
     server.add_service(Box::new(audio_service::new()));
-    #[cfg(not(any(target_os = "android", target_os = "ios")))]
+    #[cfg(not(target_os = "ios"))]
     server.add_service(Box::new(display_service::new()));
     server.add_service(Box::new(video_service::new(
         *display_service::PRIMARY_DISPLAY_IDX,
diff --git a/src/server/display_service.rs b/src/server/display_service.rs
index 30225e491..f13d87015 100644
--- a/src/server/display_service.rs
+++ b/src/server/display_service.rs
@@ -12,6 +12,7 @@ use scrap::Display;
 
 pub const NAME: &'static str = "display";
 
+#[cfg(all(windows, feature = "virtual_display_driver"))]
 const DUMMY_DISPLAY_SIDE_MAX_SIZE: usize = 1024;
 
 struct ChangedResolution {