bug fix and small modification.