fix getLastThread if none is availble