Bug fixes in background kernel script