added grid layout and fixed bug when layout region is not full