slight correction to line algorithm