Fix bug with mode