[fix] Use `global` keyword when using global variables