move some global vars from init_ to main