Fix #16 Improve thread related methods