This fixes the problem in 5.0 in the correct way. The previous patch (for 4.1) is only valid for 4.1 and is done at the right time for 4.1.