some fixes
refactor factories and tests