Updated undefined checks for smaller minified script.