removed check for window

assigned sentinel flag to track 'this' state instead of checking
for window or global. This fixes browser/node issues.