Altimeter bug: flat line in the first few minutes activity

Hello everyone, lately I have noticed a bug in the altimeter that causes it to write a flat line during the first part of activity and then return after a few minutes to detect correctly. I think it's a bug because it doesn't happen all the time but only sometimes. Is there any trick to avoid this? Like restarting the device before the activity or something else? Thanks