added test for encoding