added testcase for ControllableThread class and fixed errors accordingly