Fixed usage of wrong global variable