better exception handling for deserialization