Fix for SQL error