Replace deserializer implementation

The new one is faster. Too bad for the explicit casts, but...