added test for key encoding