fixed used sql