Fix error trace report, and take both array and object as trace input
added fallback implementation to wrap