working version. Fixes to bugs in error DB, weights from ML, others