Fix error when changing fit type before creating a box