sql alchemy fix, test refactoring, and first two tests