refine the code, use one as global variable, then problem solved