added error checking kernel