small change database, fix entities

contract statistic ongoing