Fixed issues with variable scope, static functions & output HTML
Merge branch 'release-1.9.6' into develop