bugfix for encoding