Inertial sensor doesnt set heading properly

How have you mounted the inertial sensor ? if it is at an angle when you calibrate it will slowly drift to match the angle it is mounted at. What does the dashboard show ? does it do the same thing as your code ?