more robust deserialization - closes #299