fixing sql error