Fixed bug with lni function