bugfix in if statement for encoding check