Core: resort variable can now contain a new sort. See #782