diff --git a/docker/kolab/utils/09-enable-debugging.sh b/docker/kolab/utils/09-enable-debugging.sh
index 7a7996ea..f5d50d41 100755
--- a/docker/kolab/utils/09-enable-debugging.sh
+++ b/docker/kolab/utils/09-enable-debugging.sh
@@ -1,11 +1,18 @@
 #!/bin/bash
 
-echo "chatty: 1" >> /etc/imapd.conf
-echo "debug: 1" >> /etc/imapd.conf
+if ! grep -q "chatty" /etc/imapd.conf; then
+    echo "chatty: 1" >> /etc/imapd.conf
+fi
+
+if ! grep -q "debug" /etc/imapd.conf; then
+    echo "debug: 1" >> /etc/imapd.conf
+fi
 
 systemctl restart cyrus-imapd
 
 sed -i -r -e "s/_debug'] = (.*);/_debug'] = true;/g" /etc/roundcubemail/config.inc.php
 
-echo "FLAGS=\"--fork -l debug -d 8\"" > /etc/sysconfig/wallace
+if ! grep -q "FLAGS=\"--fork -l debug -d 8\"" /etc/sysconfig/wallace; then
+    echo "FLAGS=\"--fork -l debug -d 8\"" > /etc/sysconfig/wallace
+fi
 systemctl restart wallace