final fixes to function BEAGLE_divide