fix small SQL bug