Fix error in the sql