Fixes from 5.4, and robustize tests.

Merged Simon Morlat requested to merge fix/from-5.4-may-15 into master

Merge request reports