fixed the freaking sql