p0tayters, it has been months since I did that, and I don't remember very much detail right now - but I do remember that it took a lot of tinkering to get it working right. It doesn't take much to confuse it and get strange results.
My example tried to average the gravity angle when there were overlapping zones. You may have an issue with how your zones overlap, or a problem with calculating the angle. Or you may have code changing the gravity accidentally when you don't expect it (my 13 year old son is very new to programming and he runs into problems like that all the time).