take globals into account