Was in beginers mode. Perimetes set distance 30 meters and height 30 meters. All of a sudden something started beeping. Do not know what was beeping. Drone started drifting North away from me. I pushed RTH button and drone started home however when decending started comming down towards a tree. Luckly I was able to miss the tree as controller would allow me to use sticks Safe landing. Any idea wbat could have casued near mishap/disaster. Thanks1