fix many bugs for multi-quotes function