reverted some sql queries