Update the layout and fix a bug in updating pet