Fixed bug with handling kernel threads