moved global var into pageinit