adapt grid size