fix dynamic scoping (close #86)