diff --git a/toonz/sources/include/tools/keyhistory.h b/toonz/sources/include/tools/keyhistory.h
index 0c0e5fe..eeabefe 100644
--- a/toonz/sources/include/tools/keyhistory.h
+++ b/toonz/sources/include/tools/keyhistory.h
@@ -236,7 +236,7 @@ public:
 
   StatePointer change(bool press, Type value, TTimerTicks ticks)  {
     StatePointer state = current()->change(press, value, ticks);
-    if (state != current() && state->ticks > m_states.rbegin()->first)
+    if (state != current() && ticks > m_states.rbegin()->first)
       m_states[state->ticks] = state;
     autoRemove();
     return current();
diff --git a/toonz/sources/tnztools/inputmanager.cpp b/toonz/sources/tnztools/inputmanager.cpp
index 58546f2..aacc39a 100644
--- a/toonz/sources/tnztools/inputmanager.cpp
+++ b/toonz/sources/tnztools/inputmanager.cpp
@@ -340,7 +340,7 @@ TInputManager::paintTracks() {
         paintApply((int)m_savePoints.size(), subTracks);
         // send to tool final
         if (!subTracks.empty()) {
-          m_handler->inputPaintTracks(subTracks);
+          if (m_handler) m_handler->inputPaintTracks(subTracks);
           for(TTrackList::const_iterator i = subTracks.begin(); i != subTracks.end(); ++i)
             (*i)->resetChanges();
         }
@@ -482,10 +482,12 @@ TInputManager::modifierDeactivate(const TInputModifierP &modifier) {
 void
 TInputManager::processTracks() {
   paintTracks();
-  TRectD bounds = calcDrawBounds();
-  if (!bounds.isEmpty()) {
-    m_handler->inputInvalidateRect(m_prevBounds + bounds);
-    m_nextBounds += bounds;
+  if (m_handler) {
+    TRectD bounds = calcDrawBounds();
+    if (!bounds.isEmpty()) {
+      m_handler->inputInvalidateRect(m_prevBounds + bounds);
+      m_nextBounds += bounds;
+    }
   }
 }