Investigations on a new rearrangement of azabicyclic compounds and stereochemistry of N_substituted heterocycles