Fix bug in custom layouts.