fix bugs for general use