My device does not detect my swimming distance correctly

My device cannot detect the swimming distance correctly. Sometimes it just won't detect my swimming at all making me seem to be resting for a long time. Today was the worst because my device missed 22 laps out of 42 that I did. 
I tried kicking off the wall and gliding for a couple of seconds but it did not always work. 
What else should I do?