Make HEAD and ROOT work when querying the database.

Because they did not work in, e.g., revert. Resolves #138.