add error checking for kernel calls