fixed output bugs