added error logging to ks files