fix layout and add exist check