Fixed ROI offset; store stats data in database

v0.9.8