fixed console detection so it does not throw
tested in Chrome and Firefox