yet another fix for lines calculation