Fix another weakness in the `Input` class and further harden the `deserialize()` function

Fix another weakness in the `Input` class and further harden the `deserialize()` function. Thanks to Martin Auswöger for his input.