Fix  not declared global, thanks @nitmir