Fix bugs with reg method.