Better error checking on lines