properly escape $ in nested classes
- fixes #38