Compensating for errors caused by friction