better behaviour when switching theme