Updated test.
Improved encoding init.
Removed unnecessary explicit cast.
Test tweak.