added encode tester