added failsafe thread