move resize function to right after initialize