Fix typo
Add print option to encode function