add trace feature and some error reactions