fix error in doc for aperm (plus code cleanup)
fix to apply to maintain old behaviour with objects