Fix bug in decode and add tests

Fixing a bug in the slice usage in Decode, removing the error return value since it's not used and adding some tests.