Fixed broken sql commands