fix sql issue