Backport 4360 stable5

Backport #4360 stable5

fixes #4609

@bantu @ringmaster @blizzz @schiesbn @karlitschek THX