bug fix & performance improvement