Fixing bugs in logic thread

Change-Id: Iab29ce990e05136dd3a2058b69e0934fe34158a6
Signed-off-by: TanelDettenborn <tanel.dettenborn@gmail.com>