Adding global events and fixed a bug where globals value setting was not working properly