merge bug 542 from master to v6.0 with exceptions

No match.