bug fix and brush up