Fixed error when decoding to non-pointer. Added test.