testing and fixing SQL tests