fix statefactory tests
fix model
clean up