minor fixes for cyclic schemas, start on real sql stuff