fixed SQL issue