fix for right order when changing enc variables, thanks @dominicmcginnis