bug fix and clarify comments