fix error in sql + add stat table