Don't access application class var directly
Merge pull request #4744 from wilsonge/patch-24

Don't access application class var directly