Code and test

to solve the odd encode and decode problem with our kernel lib.