Fix backward file reading function

It contained some special-case errors not caught by the current tests.
Issue fixed, new tests added.

Change-Id: I7e4f2a5547b64ceba2870b4b6eb87c1419d2fc61
Closes-Bug: #1391874
Closes-Bug: #1393795
Merge "Fix backward file reading function"