Fix scripts header
Fix tests, use session factory singleton