resize() moved to the top of init()