fixed flag and traces functionality