A SQL Bug fix, and minor updates