Added check for window.console