fixes #187 - now checks for console more safely.