bug fix and less codes