Added log record.
TODO: display log.
fixed some bugs.