KER-239: fixes needed to be able to implement a multi-threaded version of the kernel