fix issues when using minification

Current version doesn't work when using minication. This fixes all of the issues I found when using minification.