Fix test issues, add decode test