diff --git a/CMakeLists.txt b/CMakeLists.txt
index ec9f33a..3223e1c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,6 @@
 cmake_minimum_required (VERSION 3.7)
 project(controller
-        VERSION 0.3.5
+        VERSION 0.3.7
         LANGUAGES C)
 
 add_executable(controller src/main.c)
diff --git a/include/models/controller.h b/include/models/controller.h
index 1cf4fad..10d5827 100644
--- a/include/models/controller.h
+++ b/include/models/controller.h
@@ -3,7 +3,6 @@
 
 #include <uuid/uuid.h>
 #include <stdint.h>
-#include <lmdb.h>
 
 #include <config.h>
 #include <models/relay.h>
diff --git a/include/models/relay.h b/include/models/relay.h
index bbac159..498ea30 100644
--- a/include/models/relay.h
+++ b/include/models/relay.h
@@ -3,7 +3,6 @@
 
 #include <stdint.h>
 #include <time.h>
-#include <lmdb.h>
 
 #include <constants.h>
 #include <models/schedule.h>
diff --git a/include/models/schedule.h b/include/models/schedule.h
index 212cd81..ae91e14 100644
--- a/include/models/schedule.h
+++ b/include/models/schedule.h
@@ -3,7 +3,6 @@
 
 #include <stdint.h>
 #include <uuid/uuid.h>
-#include <lmdb.h>
 
 #include <models/period.h>
 
diff --git a/src/handlers/loop.c b/src/handlers/loop.c
index 035e462..2076952 100644
--- a/src/handlers/loop.c
+++ b/src/handlers/loop.c
@@ -38,17 +38,17 @@ handler_loop(struct mg_connection *c_mqtt)
 
         if(is_on_schedule)
         {
-            if(pulse_relay)
+            if(!pulse_relay)
+            {
+                is_on = 1;
+                LOGGER_DEBUG("relay %d is active\n", i);
+            }
+            if(pulse_relay && relay->pulse_timer)
             {
                 is_on = 1;
                 --relay->pulse_timer;
                 LOGGER_DEBUG("relay %d is pulsing for %d more seconds\n", i, relay->pulse_timer);
             }
-            else
-            {
-                is_on = 1;
-                LOGGER_DEBUG("relay %d is active\n", i);
-            }
         }
         else
         {
diff --git a/src/main.c b/src/main.c
index 17149e2..a13c75e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2,7 +2,6 @@
 #include <string.h>
 #include <stdio.h>
 #include <time.h>
-#include <lmdb.h>
 #include <signal.h>
 #include <syslog.h>