fixed a wrong SQL