Change floats to ints recursively on env encoding

Fixes #6246
redundant with the switch :)