fixed check error in writeLog call