Fix bug when used in MenuItem