A. Calibrate the drone's sensors before each flight. This can usually be done through the app or by following the calibration procedure in the manual.
B. Fly in an open area away from obstacles and interference. Sometimes, environmental factors can affect the drone's ability to maintain altitude.