Added -pthread in linking
Added ligd to callback to recover ligh