Fixed broken sqls, opps