fix rest factory
fix bugs
solve conflict