Fixing bug when daemon crashing when receiving data