fixed a few more variable rename issues that were breaking some sql queries