bug fix & some small changes