petra fixes to take restricted classes into accound.
This patch implements some changes needed to take restricted classes into account for example for D450, but it does not claim to be complete. This will have to be fully tested when these restrictions are really used.