added code for log file and for solving crash when playing under Xboard