fix tests
More documentation, slightly stricter types.
Merge bug26000 into stable again