Remove another usage of encode
Fix some warnings