Fixed the extra value(s) bug

Fixed bug which gives extra values due to taking the reference as a
line.