fix a bug in v3 and added check for errors after kerne invocations