Added hidden column "id" into log and events table, fixed type cast problem #781