Added Error handling for Decode()