fixed globals issue