On the non-uniform torsion in thin-walled beams