Rework of pervious commit that actually works 63ef8872 Thanks to Nikolay Zlatev <nik@astrapaging.com> BUG: 411387
mentioned in commit b9d2cd66