Change mode error @ Ardusub

Hello. I have developed an autonomous water surface vehicle with Ardusub, Navio2, Raspberry Pi, Python 3.7.
It has a problem when I command “Manual” to the vehicle on a Python code.
In most cases, the vehicle works well but sometimes it changes to “Stabilze” even though I command “Manual” like that code.

=============================================
master = mavutil.mavlink_connection(‘udp:127.0.0.1:14551’)

def set_mode(mode):
mode_id = master.mode_mapping()[mode]
master.mav.set_mode_send(
master.target_system,
mavutil.mavlink.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED,
mode_id)

set_mode(“MANUAL”)

=============================================

I can’t debug this problem.
So if you know why the thing happens, please let me know the solution.
Thank you!