to write csv file including errors for runing on R removinf backgraound values