trying to fix globals
fixed global detection