xt and xd fixed to insert time and data properly