Bug fixes in the stemstem orientation energy