bug fix and foramtting