Fix switch tab and layout API controller