bugfix: use correct length Ln to determine r_nx