fixed output reg issue