Deviation error of the magnetic compass is caused by