Fix bug with globals