Fix custom layout problem