fixed infinite loop, do'h. fixes #142. fixed #140