Fix some bugs in the items layout