Fixed SQL Bug