fix bugs + flat value model